/*
 * 广州丰石科技有限公司拥有本软件版权2020并保留所有权利。
 * Copyright 2020, Guangzhou Rich Stone Data Technologies Company Limited,
 * All rights reserved.
 */

package demo.config;

import com.richstonedt.garnet.springboot.starter.config.GarnetWebSecurityConfig;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;

/**
 * <b><code>WebSecurityConfig</code></b>
 * <p/>
 * Description
 * <p/>
 * <b>Creation Time:</b> 2020/5/11 17:49.
 *
 * @author kuangjiawei
 * @since  0.1.0
 */

//TODO:step1
@Configuration
public class WebSecurityConfig extends GarnetWebSecurityConfig {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
        .cors()//.configurationSource(this::corsConfig)
        .and();
        super.configure(http);
    }

    @Override
    public void configure(final WebSecurity web) throws Exception {
        web.ignoring()
                .antMatchers( "/swagger-ui.html", "/webjars/**", "/swagger-resources/**", "/v2/**");
    }
}
